<div id="home_page">
	<div class="container" >
		<div class="row" id="site_title">
			<div class="span7 body_section">
				<%= image_tag 'coffee_cup_4.png', :class => 'feature_image'%>
			</div>
			<div class="span5" id="site_header">
				<h1> <%= image_tag 'logo.png', :alt => 'Qcafe'%>
				<br />
				<span>Take coffee quickly!</span></h1>
			</div>
		</div>
	</div>

	<div id="home_blog">
		<div class="container">
			<h2> <%= image_tag 'empty.gif', :alt => t('blog_ca_phe')%> </h2>
			<div class="post">
				<h3 class="title"><a href="<%= @blog_ca_phe.present? ? url_for(:action=> 'index', :controller => 'bai_viet', :danh_muc_slug => @blog_ca_phe.danh_muc.slug, :bai_viet_slug => @blog_ca_phe.slug) : ""%>"><%= @blog_ca_phe.present? ? @blog_ca_phe.tieu_de : t('blog_ca_phe')%></a></h3>
				<div class="time">
					<%= raw @blog_ca_phe.present? ? @blog_ca_phe.created_at.strftime(t('dang_ngay_datetime_format'))  : ""%>
				</div>
				<div class="body">
					<%= raw @blog_ca_phe.present? ? @blog_ca_phe.noi_dung.truncate_html(900, at_end = "...")  : ""%>
				</div>
			</div>
		</div>
	</div>
	<div id="home_ca_phe">
		<div class="container">
			<div class="row">
				<div class="span3 body_section">
					<%= image_tag 'coffee_cup_5.png', :class=>"body_section_image"%>
					<br />
					<h2><%= t 'ca_phe'%>
					<br />
					<small><a href="<%= url_for :action=>'nhom_san_pham', :controller=>'san_pham', :danh_muc=>'ca_phe'%>"><%= t 'xem_tat_ca'%></a></small></h2>
				</div>
				<div class="span9">
					<% i = 0 %>
					<% while i < @so_muc_hien_thi %>
					<div class="row">
						<% for j in 0..2 %>
						<% if i + j < @ca_phes.length %>
						<% muc = @ca_phes[i + j]%>
						<div class="span3">
							<div class="san_pham preview">
								<img class="hinh_anh_dai_dien img-rounded" src="<%= muc.hinh_anh %>" />
								<br />
								<h4 class="ten_hang"><a href="<%= url_for :action => 'index', :controller=> 'san_pham', :danh_muc_slug => muc.danh_muc.slug, :san_pham_slug => muc.slug  %>"><%= muc.noi_dung(@ngon_ngu, true).tieu_de %></a></h4>
								<% if muc.co_khuyen_mai(Time.now) %>
								<span class="gia_san_pham gia_goc"> <strike><%= number_with_delimiter muc.gia, :delimiter => " "%> <span class="tien_te">VND</span></strike> </span>
								<br />
								<span class="gia_san_pham gia_khuyen_mai"> <%= number_with_delimiter muc.gia_khuyen_mai, :delimiter => " "%> <span class="tien_te">VND</span> </span>
								<br />
								<span class="thoi_gian_khuyen_mai"> <%= muc.khuyen_mai_bat_dau.strftime(t('dinh_dang_ngay'))%>  - <%= muc.khuyen_mai_ket_thuc.strftime(t('dinh_dang_ngay'))%></span>
								<% else %>
								<span class="gia_san_pham"> <%= number_with_delimiter muc.gia, :delimiter => " "%> <span class="tien_te">VND</span> </span>
								<% end %>
								<br />
								<a href="<%= url_for :action=>'mua_san_pham', :controller => 'gio_hang', :san_pham_id => muc.id %>" class="btn btn-info btn-small"><i class="icon-shopping-cart"></i> <%= t 'dat_hang'%></a>
							</div>
						</div>
						<% end %>
						<% end %>
					</div>
					<% i += 3 %>
					<% end %>
				</div>
			</div>

		</div>
	</div>
	<div class="divider"></div>
	<div id="home_giai_khat">
		<div class="container">
			<div class="row">
				<div class="span3 body_section">
					<%= image_tag 'giai_khat.png', :class=>"body_section_image"%>
					<br />
					<h2><%= t 'giai_khat'%>
						<br />
					<small><a href="<%= url_for :action=>'nhom_san_pham', :controller=>'san_pham', :danh_muc=>'giai_khat'%>"><%= t 'xem_tat_ca'%></a></small>
					
					</h2>
				</div>
				<div class="span9">
					<% i = 0 %>
					<% while i < @so_muc_hien_thi %>
					<div class="row">
						<% for j in 0..2 %>
						<% if i + j < @giai_khats.length %>
						<% muc = @giai_khats[i + j]%>
						<div class="span3">
							<div class="san_pham preview">
								<img class="hinh_anh_dai_dien img-rounded" src="<%= muc.hinh_anh %>" />
								<br />
								<h4 class="ten_hang"><a href="<%= url_for :action => 'index', :controller=> 'san_pham', :danh_muc_slug => muc.danh_muc.slug, :san_pham_slug => muc.slug  %>"><%= muc.noi_dung(@ngon_ngu, true).tieu_de %></a></h4>
								<% if muc.co_khuyen_mai(Time.now) %>
								<span class="gia_san_pham gia_goc"> <strike><%= number_with_delimiter muc.gia, :delimiter => " "%> <span class="tien_te">VND</span></strike> </span>
								<br />
								<span class="gia_san_pham gia_khuyen_mai"> <%= number_with_delimiter muc.gia_khuyen_mai, :delimiter => " "%> <span class="tien_te">VND</span> </span>
								<br />
								<span class="thoi_gian_khuyen_mai"> <%= muc.khuyen_mai_bat_dau.strftime(t('dinh_dang_ngay'))%>  - <%= muc.khuyen_mai_ket_thuc.strftime(t('dinh_dang_ngay'))%></span>
								<% else %>
								<span class="gia_san_pham"> <%= number_with_delimiter muc.gia, :delimiter => " "%> <span class="tien_te">VND</span> </span>
								<% end %>
								<br />
								<a href="<%= url_for :action=>'mua_san_pham', :controller => 'gio_hang', :san_pham_id => muc.id %>" class="btn btn-info btn-small"><i class="icon-shopping-cart"></i> <%= t 'dat_hang'%></a>
							</div>
						</div>
						<% end %>
						<% end %>
					</div>
					<% i += 3 %>
					<% end %>
				</div>
			</div>
		</div>
	</div>
	<div class="divider"></div>
	<div id="home_thuc_an_nhe">
		<div class="container">
			<div class="row">
				<div class="span3 body_section">
					<%= image_tag 'thuc_an_nhe.png', :class=>"body_section_image"%>
					<br />
					<h2><%= t 'thuc_an_nhe'%>
						<br />
					<small><a href="<%= url_for :action=>'nhom_san_pham', :controller=>'san_pham', :danh_muc=>'thuc_an_nhe'%>"><%= t 'xem_tat_ca'%></a></small>
					
					</h2>
				</div>
				<div class="span9">
					<% i = 0 %>
					<% while i < @so_muc_hien_thi %>
					<div class="row">
						<% for j in 0..2 %>
						<% if i + j < @thuc_an_nhes.length %>
						<% muc = @thuc_an_nhes[i + j]%>
						<div class="span3">
							<div class="san_pham preview">
								<img class="hinh_anh_dai_dien img-rounded" src="<%= muc.hinh_anh %>" />
								<br />
								<h4 class="ten_hang"><a href="<%= url_for :action => 'index', :controller=> 'san_pham', :danh_muc_slug => muc.danh_muc.slug, :san_pham_slug => muc.slug  %>"><%= muc.noi_dung(@ngon_ngu, true).tieu_de %></a></h4>
								<% if muc.co_khuyen_mai(Time.now) %>
								<span class="gia_san_pham gia_goc"> <strike><%= number_with_delimiter muc.gia, :delimiter => " "%> <span class="tien_te">VND</span></strike> </span>
								<br />
								<span class="gia_san_pham gia_khuyen_mai"> <%= number_with_delimiter muc.gia_khuyen_mai, :delimiter => " "%> <span class="tien_te">VND</span> </span>
								<br />
								<span class="thoi_gian_khuyen_mai"> <%= muc.khuyen_mai_bat_dau.strftime(t('dinh_dang_ngay'))%>  - <%= muc.khuyen_mai_ket_thuc.strftime(t('dinh_dang_ngay'))%></span>
								<% else %>
								<span class="gia_san_pham"> <%= number_with_delimiter muc.gia, :delimiter => " "%> <span class="tien_te">VND</span> </span>
								<% end %>
								<br />
								<a href="<%= url_for :action=>'mua_san_pham', :controller => 'gio_hang', :san_pham_id => muc.id %>" class="btn btn-info btn-small"><i class="icon-shopping-cart"></i> <%= t 'dat_hang'%></a>
							</div>
						</div>
						<% end %>
						<% end %>
					</div>
					<% i += 3 %>
					<% end %>
				</div>
			</div>
		</div>
	</div>
	<div class="divider"></div>
	<div class="container tin_qcafe">
		<div class="row">
			<h2 class="span12 text-center"><%= t'tin_qcafe'%> <small><a href="<%= url_for :action => 'danh_muc', :controller => 'bai_viet', :danh_muc => 'tin_qcafe'%>"><%= t 'xem_tat_ca'%></a></small></h2>
		</div>
		<div class="row">
			<% for i in 0..1 %>
			<% if @tin_qcafes[i].present? %>
			<div class="span6">
				<div class="post">
				<h3 class="title"><a href="<%= url_for(:action=> 'index', :controller => 'bai_viet', :danh_muc_slug => @blog_ca_phe.danh_muc.slug, :bai_viet_slug => @tin_qcafes[i].slug)%>"><%= @tin_qcafes[i].tieu_de%></a></h3>
				<div class="time">
					<%= @tin_qcafes[i].created_at.strftime(t('dang_ngay_datetime_format')) %>
				</div>
				<div class="body">
					<%= raw @tin_qcafes[i].noi_dung.truncate_html(900, at_end = "...") %>
					<p class="doc_tiep">
						<a href="<%= url_for(:action=> 'index', :controller => 'bai_viet', :danh_muc_slug => @blog_ca_phe.danh_muc.slug, :bai_viet_slug => @tin_qcafes[i].slug)%>"> ... Đọc tiếp ...</a>
					</p>
				</div>
			</div>
			</div>
			<% end %>
			<% end %>
		</div>
	</div>
</div>

<div>
	<%= render "shared/goi_y_caphe" %>
</div>
